package com.steel.yfmall.cloud.assistant.goods.impl;

import com.steel.yfmall.cloud.assistant.goods.FrameworkContractInfoService;
import com.steel.yfmall.cloud.assistant.goods.mapper.FrameworkContractInfoMapper;
import com.steel.yfmall.cloud.assistant.po.goods.FrameworkContractInfo;
import com.steel.yfmall.cloud.assistant.po.goods.FrameworkContractInfoExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 龙飞
 * @version 1.0
 * @since 2021/01/11 星期一 16:49
 */

@Service
public class FrameworkContractInfoServiceImpl implements FrameworkContractInfoService {

    @Override
    public FrameworkContractInfo selectOneByCommerceContractNoAndOrder(String commerceContractNo, String orderBy) {
            FrameworkContractInfoExample example = new FrameworkContractInfoExample();
            example.createCriteria().andCommerceContractNoEqualTo(commerceContractNo).andContractStatusEqualTo(1);
            example.setOrderByClause(orderBy);
            example.limit(0, 1);
            return frameworkContractInfoMapper.selectOneByExampleSelective(example);
    }

    @Override
    public int insert(FrameworkContractInfo info) {
        return frameworkContractInfoMapper.insertSelective(info);
    }

    @Override
    public int update(FrameworkContractInfo info) {
        return frameworkContractInfoMapper.updateByPrimaryKeySelective(info);
    }

    @Resource
    private FrameworkContractInfoMapper frameworkContractInfoMapper;
}
